package com.epam.grsulab.webapi.tools;

import java.util.List;

import com.epam.grsulab.webapi.dao.base.Dao;
import com.epam.grsulab.webapi.entity.base.BaseEntity;

/**
 * @author Dmitry_Zhivushko
 * 
 */
public interface DataInitialiser {

	/**
	 * Creates all init data. This method will be called on application startup.
	 * 
	 * EXAMPLE:
	 * 
	 * <pre>
	 * // create test DbObjects
	 * DbObject entity1 = new DbObject();
	 * entity1.setTitle(&quot;entity1&quot;);
	 * entity1 = dbObjectDao.save(entity1);
	 * final DbObject entity2 = new DbObject();
	 * entity2.setTitle(&quot;entity2&quot;);
	 * dbObjectDao.save(entity2);
	 * 
	 * // create test ReferencedDbObjects
	 * final ReferencedDbObject refEntity = new ReferencedDbObject();
	 * refEntity.setDbObject(entity1);
	 * referencedDbObjectDao.save(refEntity);
	 * </pre>
	 */
	void initData();

	/**
	 * This method should return list object which contains all DAO instances
	 * used in current application
	 * 
	 * EXAMPLE:
	 * 
	 * <pre>
	 * List&lt;Dao&lt;? extends BaseEntity&gt;&gt; list = new ArrayList&lt;Dao&lt;? extends BaseEntity&gt;&gt;();
	 * list.add(dbObjectDao);
	 * list.add(referencedDbObjectDao);
	 * return list;
	 * </pre>
	 * 
	 * @return list filled with DAOs
	 */
	List<Dao<? extends BaseEntity>> getAllDAOs();
}
